package com.feiyuan.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import com.feiyuan.common.utils.ResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feiyuan.modules.sys.entity.AppInfoEntity;
import com.feiyuan.modules.sys.service.AppInfoService;
import com.feiyuan.common.utils.PageUtils;

/**
 * 
 *
 * @author Xupf
 * @email xupengfei131276@126.com
 * @date 2024-04-22 17:12:38
 */
@RestController
@RequestMapping("/admin/sys/appinfo")
public class AppInfoController {
    @Autowired
    private AppInfoService appInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("sys:appinfo:list")
    public ResponseUtils list(@RequestParam Map<String, Object> params){
        PageUtils page = appInfoService.queryPage(params);

        return ResponseUtils.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("sys:appinfo:info")
    public ResponseUtils info(@PathVariable("id") Long id){
		AppInfoEntity appInfo = appInfoService.getById(id);

        return ResponseUtils.ok().put("appInfo", appInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//    @RequiresPermissions("sys:appinfo:save")
    public ResponseUtils save(@RequestBody AppInfoEntity appInfo){
		appInfoService.save(appInfo);

        return ResponseUtils.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("sys:appinfo:update")
    public ResponseUtils update(@RequestBody AppInfoEntity appInfo){
		appInfoService.updateById(appInfo);

        return ResponseUtils.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("sys:appinfo:delete")
    public ResponseUtils delete(@RequestBody Long[] ids){
		appInfoService.removeByIds(Arrays.asList(ids));

        return ResponseUtils.ok();
    }

}
